package io.shallwe;

import com.jfinal.kit.JsonKit;

import org.junit.Test;

import cn.hutool.socket.SocketUtil;

public class CreateInitLineInfo {


    /**
     * 
     * 
     * 
     * 
 VALUES
  ('R001','001',210);

     */
    @Test
    public void  testInit(){
        int sum =211;
        StringBuilder sqlBuilder=new StringBuilder("INSERT INTO t_line_info(hangerNo,frameNo,sort) VALUES\r\n");
         
        for (int i = 1; i < sum; i++) {
            String sequence="000";
            if(i<10){
                sequence="00"+i;
            }else if(i>99){
                sequence=""+i;
            }else{
                sequence="0"+i;
            }
            if(i==(sum-1)){
                String value="('R"+sequence+"','"+sequence+"',"+(sum-i)+");";
                sqlBuilder.append(value);
            }else{
                String value="('R"+sequence+"','"+sequence+"',"+(sum-i)+"),\r\n";
                sqlBuilder.append(value);
            }
        }

        System.out.println(sqlBuilder.toString());
        
    }

    @Test
    public void testCreate(){
        //核心顺序
        int initNo=21;

        int index=initNo;

        int[] array = new int[210];
        for (int i = 0; i < array.length; i++) {
            array[i]=index;
            index--;
            if(index==0){
                index=210;
            }
        }
        System.out.println(JsonKit.toJson(array));
    }
}
